package com.xbongbong.saas.model;

import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.paas.toolbox.wrap.IModel;
import com.xbongbong.saas.domain.entity.PayBalanceUserEntity;
import com.xbongbong.saas.domain.entity.UserTeamEntity;
import org.elasticsearch.action.support.WriteRequest;

import java.util.List;
import java.util.Map;

/**
 * @author 徐俊杰
 * @date 2020/2/24 16:22
 * @since v1.0
 */
public interface PayBalanceUserModel extends IModel<PayBalanceUserEntity> {

    /**
     * 保存实体
     *
     * @param PayBalanceUserEntity 团队实体
     * @return java.lang.Integer
     * @throws XbbException 异常
     * @author 徐俊杰
     * @date 2020/2/24 16:23
     * @since v1.0
     */
    Integer save(PayBalanceUserEntity PayBalanceUserEntity) throws XbbException;

    /**
     * 获取单个实体
     *
     * @param key id主键
     * @param corpid 公司id
     * @return com.xbongbong.saas.domain.entity.PayBalanceUserEntity
     * @author 徐俊杰
     * @date 2020/2/24 16:24
     * @since v1.0
     */
    PayBalanceUserEntity getByKey(Long key, String corpid);

    /**
     * 批量删除
     *
     * @param parentIdIn 父id集合
     * @param corpid 公司id
     * @return java.lang.Integer
     * @throws XbbException 异常
     * @author 徐俊杰
     * @date 2020/2/24 16:24
     * @since v1.0
     */
    Integer deleteBatchByParentId(List<Long> parentIdIn, String corpid) throws XbbException;

    /**
     * 批量删除的恢复
     *
     * @param parentIdIn 父id集合
     * @param corpid 公司id
     * @return java.lang.Integer
     * @throws XbbException 异常
     * @author 徐俊杰
     * @date 2020/2/24 16:25
     * @since v1.0
     */
    Integer deleteBatchRollbackByParentId(List<Long> parentIdIn, String corpid) throws XbbException;

    /**
     * 批量解散团队依据供应商id
     *
     * @param corpid 公司id
     * @param supplierIdIn 供应商id集合
     * @throws XbbException 异常
     * @author 徐俊杰
     * @date 2020/2/24 16:27
     * @since v1.0
     */
    void disbandedTeamBySupplierId(String corpid, List<Long> supplierIdIn) throws XbbException;

    /**
     * 获取符合查询条件的记录
     *
     * @param param 查询条件
     * @return java.util.List<com.xbongbong.saas.domain.entity.PayBalanceUserEntity>
     * @author 徐俊杰
     * @date 2020/2/24 16:28
     * @since v1.0
     */
    @Override
    List<PayBalanceUserEntity> findEntitys(Map<String, Object> param);

    List<UserTeamEntity> findBaseEntitys(Map<String, Object> map);

    void insertBatch(List<PayBalanceUserEntity> payBalanceUserEntityList) throws XbbException;

    void insertBatch(List<PayBalanceUserEntity> payBalanceUserEntityList, WriteRequest.RefreshPolicy refreshPolicy) throws XbbException;

    void batchUpdateByUserIdIn(String corpid, List<Long> idIn, List<UserTeamEntity> teamEntityList, Integer isMain, Integer del) throws XbbException;

    void batchUpdateByUserIdIn(String corpid, List<Long> idIn, List<UserTeamEntity> teamEntityList, Integer isMain, Integer del, WriteRequest.RefreshPolicy refreshPolicy) throws XbbException;

    void batchUpdateByUserIds(String corpid, List<Long> idIn, List<PayBalanceUserEntity> teamEntityList, Integer isMain, Integer del) throws XbbException;

    void deleteBatchUser(List<PayBalanceUserEntity> payBalanceUserEntityList, String corpid) throws XbbException;


    void batchUpdateCoAndPerByUserIdIn(String corpid, List<Long> dataIdIn, List<UserTeamEntity> teamEntityList, Integer isMain, boolean needThrow) throws XbbException;

    void batchUpdateCoAndPerByUserIdIn(String corpid, List<Long> dataIdIn, List<UserTeamEntity> teamEntityList, Integer isMain, boolean needThrow, WriteRequest.RefreshPolicy refreshPolicy) throws XbbException;

    /**
     * 获取需要处理的公司
     *
     * @return
     */
    List<String> getAllCorpList();
}
